import request from '@/utils/request'
import {parseStrEmpty} from "@/utils/lanling";

// 查询列表
export function listCompany(query) {
  return request({
    url: '/system/company/page',
    method: 'get',
    params: query
  })
}

// 查询列表
export function list(query) {
  return request({
    url: '/system/company/list',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getCompany(id) {
  return request({
    url: '/system/company/' + parseStrEmpty(id),
    method: 'get'
  })
}

export function getCompanyDetail() {
  return request({
    url: '/system/company/getDetail',
    method: 'get',
  })
}

// 新增
export function addCompany(data) {
  return request({
    url: '/system/company',
    method: 'post',
    data: data
  })
}

// 修改
export function updateCompany(data) {
  return request({
    url: '/system/company',
    method: 'put',
    data: data
  })
}

// 状态修改
export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/system/company/changeStatus',
    method: 'put',
    data: data
  })
}

// 删除
export function delCompany(id) {
  return request({
    url: '/system/company/' + id,
    method: 'delete'
  })
}


export function changePayTypeStatus(id, payType) {
  const data = {
    id,
    payType
  }
  return request({
    url: '/system/company/changePayTypeStatus',
    method: 'put',
    data: data
  })
}


export function changePaymentTypeStatus(id, paymentType) {
  const data = {
    id,
    paymentType
  }
  return request({
    url: '/system/company/changePaymentTypeStatus',
    method: 'put',
    data: data
  })
}

export function changePublicOpen(id, publicOpen) {
  const data = {
    id,
    publicOpen
  }
  return request({
    url: '/system/company/changePublicOpen',
    method: 'put',
    data: data
  })
}

